<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb separator="/" style="margin-bottom: 15px">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片 -->
    <el-card>
      <!-- 内容 -->
      <div class="text item">
        <el-table :data="tableData" stripe style="width: 100%" border>
          <el-table-column
            type="index"
            width="50"
            style="margin-left: 8px"
          ></el-table-column>
          <el-table-column prop="authName" label="权限名称"> </el-table-column>
          <el-table-column prop="path" label="路径"> </el-table-column>
          <el-table-column prop="level" label="权限等级">
            <template #default="{ row }">
              <el-tag v-if="row.level === '0'">一级</el-tag>
              <el-tag v-else-if="row.level === '1'" type="success">二级</el-tag>
              <el-tag v-else type="warning">三级</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script>
import { rightList } from '@/api/right'
export default {
  name: 'my-rights',
  data () {
    return {
      tableData: []
    }
  },

  created () {
    this.obtain()
  },

  methods: {
    async obtain () {
      const res = await rightList()
      console.log(res.data)
      this.tableData = res.data
    }
  }
}
</script>

<style scoped lang='less'>
</style>
